import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-05-19
 * Time: 21:32
 */
abstract class Animal {
    public String name;
    public String color;
    public Animal(String name, String color) {
        this.name = name;
        this.color = color;
    }
    public abstract void introduce();
    public abstract void action();
}
class Dog extends Animal {

    public int intel;
    public Dog(String name, String color, int intel) {
        super(name, color);
        this.intel = intel;
    }

    @Override
    public void introduce() {
        System.out.println("My name is " + name + ", my color is " + color + ", my IQ is " + intel);
    }

    @Override
    public void action() {
        System.out.println("catch frisbee");
    }
}
class Cat extends Animal{
    public String eye;

    public Cat(String name, String color, String eye) {
        super(name, color);
        this.eye = eye;
    }


    @Override
    public void introduce() {
        System.out.println("My name is " + name + ", my color is " + color + ", my eyecolor is " + eye);

    }

    @Override
    public void action() {
        System.out.println("catch mouse");
    }
}
class TestAnimal{
    public static void introduce(Animal animal) {
        animal.introduce();
    }

    public static void action(Animal animal) {
        animal.action();
    }
}
class Student {
    private int ID;
    private String name;
    private String sex;

    public Student(int ID, String name, String sex) {
        this.ID = ID;
        this.name = name;
        this.sex = sex;
    }

    public int getID() {
        return ID;
    }

    public void setID(int ID) {
        this.ID = ID;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }
    public void attendClass(String className){
    }
    public void print(){
        System.out.println("no: " + ID);
        System.out.println("name: " + name);
        System.out.println("sex: " + sex);
    }
}
class CollegeStudent extends Student{

    private String major;
    public CollegeStudent(int ID, String name, String sex, String major) {
        super(ID, name, sex);
        this.major = major;
    }

    public String getMajor() {
        return major;
    }

    public void setMajor(String major) {
        this.major = major;
    }

    @Override
    public void print() {
        super.print();
        System.out.println("major: " + major);
    }
}
class GraduateStudent extends CollegeStudent {

    private String teacher;

    public String getTeacher() {
        return teacher;
    }

    public void setTeacher(String teacher) {
        this.teacher = teacher;
    }

    public GraduateStudent(int ID, String name, String sex, String major, String teacher) {
        super(ID, name, sex, major);
        this.teacher = teacher;
    }
    public void doResearch(){
        System.out.println(super.getName() + " is doing research");
    }

    @Override
    public void print() {
        super.print();
        System.out.println("supervisor: " + teacher);
    }
}
class BatteryCharger{
    public int[] num;
    public BatteryCharger(int[] nums) {
        num =nums;
    }
    public int getChargeCost(int startHour, int chargeTime) {
        int money = 0;
        for (int i = startHour; i < chargeTime + startHour; i++) {
            money += num[i % 24];
        }
        return money;
    }
    int getChargeStartTime(int chargeTime) {
        int money = Integer.MAX_VALUE;
        int index = 0;
        for (int i = 0; i < 24; i++) {
            int m = getChargeCost(i, chargeTime);
            if(money > m) {
                money = m;
                index = i;
            }
        }
        return index;
    }
}
public class demo2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arrA = new int[n];
        for (int i = 0; i < n; i++) {
            arrA[i] = scanner.nextInt();
        }
        int[] arrB = Arrays.copyOf(arrA, arrA.length);
        Arrays.sort(arrB);
        int count1 = 0;
        int count2 = 0;
        int count3 = 0;
        for (int i = 0; i < arrA.length; i++) {
            if (arrA[i] > arrB[i]) {
                count1++;
            } else if (arrA[i] == arrB[i]) {
                count2++;
            } else {
                count3++;
            }
        }
        System.out.println(count1);
        System.out.println(count2);
        System.out.println(count3);
    }
    public static void main4(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }
        int m = scanner.nextInt();
        Arrays.sort(arr);
        int index = Arrays.binarySearch(arr, m);
        if (index < 0) {
            System.out.println(-1);
            return;
        }
        System.out.println(index + 1);
    }
    public static void main3(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] nums = new int[24];
        for (int i = 0; i < 24; i++) {
            nums[i] = scanner.nextInt();
        }
        BatteryCharger batteryCharger = new BatteryCharger(nums);
        int start = scanner.nextInt();
        int end = scanner.nextInt();
        System.out.println(batteryCharger.getChargeCost(start, end));
        int length = scanner.nextInt();
        System.out.println(batteryCharger.getChargeStartTime(length));
    }
    public static void main2(String[] args) {
        Scanner scan = new Scanner(System.in);
        int no = scan.nextInt();
        String name = scan.next();
        String sex = scan.next();
        Student s = new Student(no, name, sex);
        s.print();

        no = scan.nextInt();
        name = scan.next();
        sex = scan.next();
        String major = scan.next();
        CollegeStudent c = new CollegeStudent(no, name, sex, major);
        c.print();

        no = scan.nextInt();
        name = scan.next();
        sex = scan.next();
        major = scan.next();
        String supervisor = scan.next();
        GraduateStudent g = new GraduateStudent(no, name, sex, major, supervisor );
        g.print();
        g.doResearch();
        scan.close();
    }
    public static void main1(String args[]) {

        Scanner s = new Scanner (System.in);
        int i = s.nextInt();
        Animal a = null;
        if (i==1) {
            a = new Cat(s.next(), s.next(), s.next());
        } else if (i==2) {
            a = new Dog(s.next(), s.next(), s.nextInt());
        }
        TestAnimal.introduce(a);
        TestAnimal.action(a);

    }
}
